package 笔试题.滴滴;

import java.util.*;

/**
 * 任务调度最短时间 91%
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String nstr = sc.nextLine();
        int n = Integer.parseInt(nstr);
        int count = 0;
        List<Integer> prepare = new ArrayList<>();
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String s = sc.nextLine();
            String[] split = s.split(" ");
            int preTime = Integer.parseInt(split[0]);
            int exeTime = Integer.parseInt(split[1]);
            prepare.add(preTime);
            map.put(preTime, exeTime);
        }
        Collections.sort(prepare);
        for (int i = 0; i < prepare.size(); i++) {
            int curPretime = prepare.get(i);
            if (count < curPretime) count = curPretime;
            count += map.get(curPretime);
        }
        System.out.println(count);
    }
}
